<!DOCTYPE html>
<html>
<head>
    <meta charset='utf-8'>
    <meta http-equiv='X-UA-Compatible' content='IE=edge'>
    <title>Page Title</title>
    <meta name='viewport' content='width=device-width, initial-scale=1'>
    <link rel='stylesheet' type='text/css' media='screen' href='main.css'>
    <script src='main.js'></script>
</head>
<body>
    <script>
        function isLeapYear(year) {
    return (year % 4 === 0 && year % 100 !== 0) || (year % 400 === 0);
}

console.log(isLeapYear(2024)); 
console.log(isLeapYear(2100)); 


function isAdult(age) {
    return age >= 18;
}
console.log(isAdult(20)); 
console.log(isAdult(17)); 


function convertScore(score) {
    let level;
    switch (Math.floor(score / 10)) {
        case 10:
        case 9:
            level = 'A';
            break;
        case 8:
            level = 'B';
            break;
        case 7:
            level = 'C';
            break;
        case 6:
            level = 'D';
            break;
        default:
            level = 'E';
    }
    return level;
}
console.log(convertScore(85)); 
console.log(convertScore(59)); 


function getWeekday(day) {
    let weekday;
    switch (day) {
        case 1:
            weekday = '星期一';
            break;
        case 2:
            weekday = '星期二';
            break;
        case 3:
            weekday = '星期三';
            break;
        case 4:
            weekday = '星期四';
            break;
        case 5:
            weekday = '星期五';
            break;
        case 6:
            weekday = '星期六';
            break;
        case 7:
            weekday = '星期日';
            break;
        default:
            weekday = '输入错误，请输入1~7之间的数字';
    }
    return weekday;
}
console.log(getWeekday(3));
console.log(getWeekday(8)); 
    </script>
</body>
</html>